<!doctype html>
<html class="no-js">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>{$meta_title}</title>
  
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta name="renderer" content="webkit">
  <meta http-equiv="Cache-Control" content="no-siteapp" />
  <link rel="icon" type="image/png" href="">
  <link rel="apple-touch-icon-precomposed" href="">
  <meta name="apple-mobile-web-app-title" content="{$meta_title}" />
  <link rel="stylesheet" href="__ROOT__/Application/Home/View/default/assets/css/amazeui.min.css"/>
  <link rel="stylesheet" href="__ROOT__/Application/Home/View/default/assets/css/admin.css">
  <link rel="stylesheet" href="__ROOT__/Application/Home/View/default/assets/css/mycss.css">
<script type="text/javascript" src="__PUBLIC__/libs/dingding/javascripts/zepto.min.js"></script>
  <script type="text/javascript" src="http://g.alicdn.com/dingding/dingtalk-pc-api/2.6.2/index.js"></script>

</head>
<body>
<style>
.page{ clear:both; text-align:center; padding:30px 10px 30px 10px; height:40px;}
.page li{    display: inline;   margin-right: 8px;}
li.active.current a {
    background: #0e90d2;
	border: 1px solid #0e90d2;
    color: #fff;
}
.page a{
	color: #0e90d2;
	font-size: 0.9em;
	border: 1px solid #ddd;
	text-decoration: none;
	padding:8px 12px;
}
.page a:hover{ background-image:none; background-color:#ccc; color:#FFF;}
.page strong{ background-color:#0e90d2; padding:4px 8px; color:#FFF;border: 1px solid #0e90d2; font-weight:normal;}

.am-dropdown{
	background-color:#fff;
}
</style>

<div class="am-cf admin-main">
  <!-- sidebar start -->
  <div class="admin-sidebar am-offcanvas" id="admin-offcanvas">
    <div class="am-offcanvas-bar admin-offcanvas-bar">
      <ul class="am-list admin-sidebar-list">
        <li ><a href="#"><span><img alt="{$user_info.name}" src="{$user_info.avatar}"  style="display: block; margin: 0 auto; width: 80%;border-radius: 50%;"></span> {$user_info.name}</a></li>
        <li ><a href="/Home/Task/shouye"><span class="am-icon-home"></span> 首页</a></li>
        <li class="nav-active"><a href="/Home/Project/index"><span class="am-icon-briefcase"></span>项目</a></li>      
      </ul>
      
    </div>
  </div>
  <!-- sidebar end -->

<!-- content start -->
<div class="admin-content">
  <div class="admin-content-body">
    <div class="am-cf am-my-title">{$meta_title}</div>
    
    <div class="am-g am-my-margin1">
						
						<div class="am-u-md-12">
							<div class="am-btn-toolbar am-u-md-4 am-margin-right">
								<a href="{:U('Home/Project/add')}">
									<div class="am-btn-group am-btn-group-xs">
										<button type="button" class="am-btn am-btn-default" style="font-size: 1.4rem;"><span class="am-icon-plus"></span> 新增</button>
									</div>
								</a>
								<a href="{:U('Home/Project/index')}">
						            <div class="am-btn-group am-btn-group-xs">
						              <button type="button" class="am-btn am-btn-default" style="font-size: 1.4rem;"><span class="am-icon-archive"></span> 我的项目</button>
						            </div> 
					            </a>
							</div>
						
							<div class="am-form-group am-u-md-4">
					            <select name="keywords" id="project_select" data-am-selected="{btnSize: 'sm'}">
					            <option value="0" >请选择</option>
					            	<volist name="project_status" id="vo" >
					            		<option value="{$vo.fieldvalue}">{$vo.title}</option>
						            </volist>
					              
					            </select>
					          </div>
														
							<div class="am-input-group am-input-group-sm">
					            <input type="text" class="am-form-field" id="so_project" placeholder="请输入项目编号/名称">
					          <span class="am-input-group-btn">
					            <button class="am-btn am-btn-default" type="button" id="search">搜索</button>
					          </span>
					          </div>
						</div>
				</div>    
                 
      <div class="am-g">
      	<div class="am-u-sm-12">
      	<div class="am-bg-white table-body">
          <table class="am-table am-table-striped am-table-hover table-main">
            <thead>
            <tr>
             
            		<th >编号</th>
					<th >名称</th>
					<th >客户</th>
					<th >负责人</th>
					<th >客服</th>
					<th >状态</th>
					<th >总金额</th>
					<th >操作</th>
            </tr>
            </thead>
            <tbody>
            <volist name="data_list" id="vo" key="k">
				<tr >

					<td >{$vo.project_number}</td>
					<td ><a href="javascript:;" onclick="projectInfo({$vo.id});">{$vo.project_name}</a></td>
					<td >{$vo.customerid}</td>
					<td >{$vo.responsible_person}	</td>
					<td >{$vo.customer_service_id}</td>
					<td >{$vo.status_text}</td> 
					<td >{$vo.total_amount}</td>
					
					<td>
						<div class="am-btn-toolbar">
		                    <div class="am-btn-group am-btn-group-xs">
		                      <a href="{:U('Home/Project/edit',array('id'=>$vo['id']))}">
		                      <button class="am-btn am-btn-default am-btn-xs am-text-secondary" ><span class="am-icon-pencil-square-o"></span> 编辑</button>
		                      </a>
		                      <a href="javascript:;" onclick="getservice({$vo.id},'Project');">
								<button class="am-btn am-btn-default am-btn-xs am-text-secondary" ><span class="am-icon-file"></span> 服务</button>
								</a>
		                      <!-- <button class="am-btn am-btn-default am-btn-xs am-text-danger am-hide-sm-only" onclick="del_project({$vo['id']});"><span class="am-icon-trash-o"></span> 删除</button> -->
		                    </div>
	                  	</div>
					</td>
				</tr>
				</volist>
                        
            
            </tbody>
          </table>
          
          <div class="page">
					{$page}
				</div>
          </div>
        </div>
      </div>


  </div>

  
</div>
<!-- content end -->

</div>

<script type="text/javascript" >

//搜索服务器
$('#search').click(function(){
	var keyword=$('#so_project').val();
	var keywords=$('#project_select option:selected') .val();
	
	if(keywords && keyword ){
		window.location.href='/Home/Project/index/keyword/'+keyword+'/keywords/'+keywords;
	}else if(keywords  && !keyword ){
		window.location.href='/Home/Project/index/keywords/'+keywords;
	}else{
		window.location.href='/Home/Project/index/keyword/'+keyword;
	}
});

 //删除
 function del_customer(id){
	 DingTalkPC.device.notification.confirm({
		    message: "您确定删除此信息吗？",
		    title: "操作提示",
		    buttonLabels: ['确定', '取消'],
		    onSuccess : function(result) {
		        /*
		        {
		            buttonIndex: 0 //被点击按钮的索引值，Number类型，从0开始
		        }
		        */
		        if(result.buttonIndex==0){
		        	var params = {};
					params.id=id;
					var url="{:U('Home/Customer/delCustomerAjax')}";
					$.post(url,params,function(data) {
						if(data.info==1){
							DingTalkPC.device.notification.toast({
							    type: "success", //toast的类型 alert, success, error, warning, information, confirm
							    text: '删除成功！', //提示信息
							    duration: 3, //显示持续时间，单位秒，最短2秒，最长5秒
							    delay: 0, //延迟显示，单位秒，默认0, 最大限制为10
							    onSuccess : function(result) {
							        /*{}*/
							    },
							    onFail : function(err) {}
							})
							
							window.location.reload();
						}else{
							DingTalkPC.device.notification.toast({
							    type: "error", //toast的类型 alert, success, error, warning, information, confirm
							    text: '删除失败！', //提示信息
							    duration: 3, //显示持续时间，单位秒，最短2秒，最长5秒
							    delay: 0, //延迟显示，单位秒，默认0, 最大限制为10
							    onSuccess : function(result) {
							        /*{}*/
							    },
							    onFail : function(err) {}
							})
						}
							
						
					});
		        }
		    	
		    },
		    onFail : function(err) {}
		});
	 	
 }

	 function projectInfo(id){
		 
		 var host="{$HTTP_HOST}";
		 DingTalkPC.biz.util.openModal({
			    size:'meddle',  // modal的尺寸
			    url: host+"/Home/Project/projectinfo/id/"+id, //打开modal的内容的url
			    title: '项目详情', //顶部标题
			    onSuccess : function(result) {
			       /*
			            调用biz.navigation.quit接口进入onSuccess, result为调用biz.navigation.quit传入的数值
			        */
			    },
			    onFail : function() {
			        /*
			            tips:点击左上角关闭按钮会进入onFail
			         */
			    }
			})
	 }
	 
	//获取服务信息
	 function getservice(id,type) {

	 	var host = "{$HTTP_HOST}";
	 	DingTalkPC.biz.util.openModal({
	 		size: 'meddle', // modal的尺寸
	 		url: host + "/Home/Service/getservice/id/" + id+"/type/"+type, //打开modal的内容的url
	 		title: '服务信息', //顶部标题
	 		onSuccess: function(result) {
	 			
	 		},
	 		onFail: function() {
	 			
	 		}
	 	})
	 }
 
</script>

<script src="__ROOT__/Application/Home/View/default/assets/js/jquery.min.js"></script>

<script src="__ROOT__/Application/Home/View/default/assets/js/amazeui.min.js"></script>
<script src="__ROOT__/Application/Home/View/default/assets/js/app.js"></script>
</body>
</html>
